<?php

defined('_JEXEC') or die;

$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$user = JFactory::getUser();
$this->language = $doc->language;
$this->direction = $doc->direction;

$params = $app->getTemplate(true)->params;

$option = $app->input->getCmd('option', '');
$view = $app->input->getCmd('view', '');
$layout = $app->input->getCmd('layout', '');
$task = $app->input->getCmd('task', '');
$itemid = $app->input->getCmd('Itemid', '');
$sitename = $app->get('sitename');

$doc->setHtml5(true);

if ($task == "edit" || $layout == 'form') {
    $fullWidth = 1;
}
else {
    $fullWidth = 0;
}

$doc->addScript($this->baseurl . '/templates/' . $this->template . '/js/jquery.min.js');
$doc->addScript($this->baseurl . '/templates/' . $this->template . '/js/bootstrap.min.js');
$doc->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/bootstrap.min.css');
$doc->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/bootstrap-theme.min.css');
$doc->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/ie10-viewport-bug-workaround.css');
$doc->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/template.css');

// disable builtin bootstrap2.x
$headData = $doc->getHeadData();
$scripts = $headData['scripts'];

unset($scripts[JUri::root(true) . '/media/jui/js/jquery-noconflict.js']);
unset($scripts[JUri::root(true) . '/media/jui/js/bootstrap.min.js']);
unset($scripts[JUri::root(true) . '/media/jui/js/jquery-migrate.min.js']);
$headData['scripts'] = $scripts;
$doc->setHeadData($headData);
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language ?>" lang="<?php echo $this->language ?>" dir="<?php echo $this->direction ?>">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <jdoc:include type="head" />
</head>
<body>
    <div id="docs-head">
        <span class="formlogo"><a href="/index.php"></a></span>
        <span class="headlink"> 
 <?php if ($user->id): ?>
                <a href="/index.php?option=com_console&view=Overview&Itemid=127" >Console</a>
                <span id="user" class="colwhite pre_pos"><?php echo $user->username ?>
                    <div class="adminshow">
                        <ul>
                            <li><a href="/index.php/user-profile">Profile</a></li>
                            <!-- <li><a href="/index.php/reset-password">Change<br />Password</a></li> -->
                            <li><a href="/index.php?option=com_users&view=login&layout=logout&task=user.menulogout&Itemid=152">Logout</a></li>
                        </ul>
                    </div>
                </span>
                <?php endif ?>
        </span>
    </div>
    <div id="docs-content">
        <div id="docs-menu">
            <jdoc:include type="modules" name="position-4"/>
        </div>
        <div id="docs-article">
            <jdoc:include type="component"/>
        </div>
    </div>
    <div id="docs-foot">
        Copyright @ 2015 (c) AdGyde
    </div>
<script type="text/javascript">
    $(function(){
        function onresizeheight(){
            $("#docs-menu").css({"height":$(window).height()-$("#docs-head").height()-$("#docs-foot").height()}); //自动调整页面高度
            $("#docs-ws").css({"height":$(window).height()-$("#docs-head").height()-$("#docs-foot").height()}); //自动调整页面高度
        }
        window.onresize = onresizeheight;  
        onresizeheight(); 
        $("#user").hover(function(){
            $(this).find("div").show();
        },function(){
            $(this).find("div").hide();
        });
    })
</script> 
</body>
</html>
